package com.yk.filedownload.combiner.combinerCell.impl;

import com.yk.filedownload.DataTransfer.RedisOp.RedisOperation;
import com.yk.filedownload.DataTransfer.RedisOp.impl.RedisOperationImpl;
import com.yk.filedownload.combiner.combinerCell.CombinCommonCell;
import com.yk.filedownload.entity.DataCarrier;
import com.yk.filedownload.util.logger.ExceptionCatcher;
import org.apache.log4j.Logger;
import org.json.JSONObject;

import java.io.*;
import java.util.Scanner;

/**
 * Project Name:cykfiledownload
 * File Name:MuilFileCombinerCell
 * Package Name:com.yk.filedownload.combiner.combinerCell.impl
 * Date:2017\12\14 0014
 * Author:dengtianjia
 * Description:
 * Copyright (c) 2017, 重庆云凯科技有限公司 All Rights Reserved.
 */
public class MuilFileCombinerCell extends CombinCommonCell {

    private Logger logger = Logger.getLogger(MuilFileCombinerCell.class);

    private RedisOperation redisOperation;
    //文件id
    private String FileID;
    //文件数
    private int packNum;
    //文件大小
    private int fileSize;
    //文件后缀
    private String fileType;

    private ExceptionCatcher catcher = new ExceptionCatcher();

    public MuilFileCombinerCell(String FileID,int packNum , int fileSize ,String fileType){
        redisOperation = new RedisOperationImpl();
        this.FileID  = FileID ;
        this.packNum = packNum;
        this.fileSize = fileSize;
        this.fileType = fileType ;
    }

    @Override
    public void run() {
        try {
            File file = new File("H:/test/file/"+FileID+"."+fileType);
            BufferedOutputStream ps = new BufferedOutputStream(new FileOutputStream(file));

            InputStreamReader reader = new InputStreamReader(new FileInputStream("H:/test/file/"+FileID+"@"+0+".txt"),"ISO-8859-1");





        }catch (Exception e){
            catcher.catchException(e,logger,this);
        }
    }
    @Override
    public void writeIntoSys(byte[] data) {


    }

}
